package com.xmhmyh.generalframework.common.wxutils.util;

/**
 * @Author: 于丁
 * 获取微信请求的URL
 * @DateTime: 2020/4/20 2:04 下午
 */
public class WxUrl {

    public static final String UNIFIEDORDERURL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
    //退款链接
    public static final String REFUNDURL = "https://api.mch.weixin.qq.com/secapi/pay/refund";

    public static String getJscode2sessionUrl(String appId, String appSecret, String code) {
        return "https://api.weixin.qq.com/sns/jscode2session?appid=" + appId + "&secret=" + appSecret + "&js_code=" + code + "&grant_type=authorization_code";
    }

    public static String getGzhLoginUrl(String appId, String appSecret, String code) {
        return "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appId + "&secret=" + appSecret + "&code=" + code + "&grant_type=authorization_code";
    }

    public static String getTokenUrl(String appId, String appSecret) {
        return "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
    }

    public static String getJSAPI_TICKET(String token) {
        return "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + token + "&type=jsapi";
    }

    public static String getWxAccessToken(String appId, String appSecret) {
        return "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
    }

    public static String getWeixinUserInfoByOpenId(String token, String openid) {
        return "https://api.weixin.qq.com/sns/userinfo?access_token=" + token + "&openid=" + openid + "&lang=zh_CN";
    }

    public static String getQrCodeUrl(String accessToken) {
        return "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="+accessToken;
    }
}
